<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>粘滞定位</title>
    <style>
        * {margin: 0; padding: 0;}
        body {
            height: 2000px;
        }
        a {
            color: white;
            text-decoration: none;
            font-size: 22px;
            font-weight: 900;
            display: block;
        }
        

        ul {
            list-style: none;
        }
        li {
            box-sizing: border-box;
            width: 200px;
            height: 50px;
            line-height: 50px;
            color: white;
            background-color: #333;
            float: left;
            text-align: center;
        }
        li:hover {
            background-color: #222;
            color: antiquewhite;
        }
        .nav-bar {
            width: 1200px;
            margin: 0 auto;
            position: sticky;
            top: 20px;
        }

    </style>
</head>
<body>
    <ul class="nav-bar">
        <li><a href="#">首页</a></li>
        <li><a href="#">前端开发</a></li>
        <li><a href="#">大数据与人工智能</a></li>
        <li><a href="#">Golang</a></li>
        <li><a href="#">C++</a></li>
        <li><a href="#">更多...</a></li>
    </ul>
</body>
</html>